#include <iostream>

using namespace std;
const int N = 16;

int Min(int* ar, int l, int size) {
    int um = 0;
    for(int i = l; i < size; i++) {
        if(ar[i] < ar[um]) {
            um = i;
        }
    }
    return um;
}

void SelectionSort(int* ar, int size) {
    for(int i = 0; i < size; i++) {
        int um = Min(ar, i, N);
        int yh = ar[i];
        ar[i] = ar[um];
        ar[um] = yh;
    }
    for(int j = 0; j < size; j++) {
        cout<<ar[j]<<" ";
    }
}

int main() {
    int ar[N] = {7, 5, 2, 3, 6, 2, 4, 4, 7, 2, 6, 1, 5, 1, 4, 7};
    SelectionSort(ar, N);
    cout << "Hello world!" << endl;
    return 0;
}
